home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / Tool Chest / Interfaces / MPW Interfaces / CIncludes / Dictionary.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-17  |  3.3 KB  |  129 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Dictionary.h
  3.  
  4.     Copyright:    © 1983-1993 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Version:    System 7.1 for ETO #11
  8.     Created:    Tuesday, March 30, 1993 18:00
  9.  
  10. */
  11.  
  12. #ifndef __DICTIONARY__
  13. #define __DICTIONARY__
  14.  
  15. #ifndef __TYPES__
  16. #include <Types.h>
  17. #endif
  18.  
  19. #ifndef __FILES__
  20. #include <Files.h>
  21. #endif
  22.  
  23. /*------------------------------------------------------------------------------------------
  24.     Constant definitions.
  25. ------------------------------------------------------------------------------------------ */
  26.  
  27. /* Dictionary data insertion modes. */
  28.  
  29. enum {
  30.  kInsert = 0,            /* Only insert the input entry if there is nothing in the dictionary that matches the key. */
  31.  kReplace = 1,            /* Only replace the entries which match the key with the input entry. */
  32.  kInsertOrReplace = 2    /* Insert the entry if there is nothing in the dictionary which matches the key. */
  33.                         /* If there is already matched entries, replace the existing matched entries with the input entry. */
  34. };
  35. typedef short InsertMode;
  36.  
  37. /* Key attribute constants.        */
  38.  
  39. #define        kIsCaseSensitive            0x10        /* case sensitive = 16        */
  40. #define        kIsNotDiacriticalSensitive    0x20        /* diac not sensitive = 32    */
  41.  
  42. /* Registered attribute type constants.    */
  43.  
  44. enum {
  45.  kNoun        =    -1,
  46.  kVerb        =    -2,
  47.  kAdjective    =    -3,
  48.  kAdverb    =    -4
  49. };
  50. typedef short AttributeType;
  51.  
  52. /* ------------------------------------------------------------------------------------------
  53.  
  54.     Type definitions.
  55.  
  56. ------------------------------------------------------------------------------------------ */
  57.  
  58. /* Dictionary information record.    */
  59.  
  60. struct DictionaryInformation{
  61.     FSSpec            dictionaryFSSpec;
  62.     long            numberOfRecords;
  63.     long            currentGarbageSize;
  64.     ScriptCode        script;    
  65.     short            maximumKeyLength;
  66.     unsigned char    keyAttributes;
  67. };
  68.  
  69. typedef struct DictionaryInformation DictionaryInformation;
  70.  
  71.  
  72.  
  73. /* --------------------------------------------------------------------------------------
  74.  
  75.     Function ProtoTypes.
  76.  
  77. -------------------------------------------------------------------------------------- */
  78.  
  79. #ifdef __cplusplus
  80. extern "C" {
  81. #endif
  82.  
  83. pascal OSErr InitializeDictionary(FSSpecPtr theFsspecPtr, short maximumKeyLength, 
  84.  unsigned char keyAttributes, ScriptCode script )
  85. = { 0x303C,0x0500,0xAA53 };
  86.  
  87. pascal OSErr OpenDictionary( FSSpecPtr theFsspecPtr,
  88.  char accessPermission,
  89.  long *dictionaryReference )
  90. = { 0x303C,0x0501,0xAA53 };
  91.  
  92. pascal OSErr CloseDictionary( long dictionaryReference )
  93. = { 0x303C,0x0202,0xAA53 };
  94.  
  95. pascal OSErr InsertRecordToDictionary( long dictionaryReference, 
  96.  ConstStr255Param key, 
  97.  Handle recordDataHandle, 
  98.  InsertMode whichMode )
  99. = { 0x303C,0x0703,0xAA53 };
  100.  
  101. pascal OSErr DeleteRecordFromDictionary( long dictionaryReference, 
  102.  ConstStr255Param key )
  103. = { 0x303C,0x0404,0xAA53 };
  104.  
  105. pascal OSErr FindRecordInDictionary( long dictionaryReference, 
  106.  ConstStr255Param key, 
  107.  Ptr requestedAttributeTablePointer, 
  108.  Handle recordDataHandle )
  109. = { 0x303C,0x0805,0xAA53 };
  110.  
  111. pascal OSErr FindRecordByIndexInDictionary( long dictionaryReference, 
  112.  long recordIndex, 
  113.  Ptr requestedAttributeTablePointer, 
  114.  Str255 recordKey,
  115.  Handle recordDataHandle )
  116. = { 0x303C,0x0A06,0xAA53 };
  117.  
  118. pascal OSErr GetDictionaryInformation( long dictionaryReference,
  119.  DictionaryInformation *theDictionaryInformation)
  120. = { 0x303C,0x0407,0xAA53 };
  121.  
  122. pascal OSErr CompactDictionary( long dictionaryReference )
  123. = { 0x303C,0x0208,0xAA53 };
  124.  
  125. #ifdef __cplusplus
  126. }
  127. #endif
  128.  
  129. #endif __Dictionary__